<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <form action="">
            <table for="">
                <tr>
                    <td hidden>Id:<input type="text" name="Id"> </td>
                </tr>
                <tr>
                    <td>季 节:<input type="text" name="season"></td>
                </tr>
                <tr>
                    <td>日 期:<input type="text" name="date"></td>
                </tr>
                <tr>
                    <td>
                        <input type="button" value="保存" onclick="save()">
                        <input type="button" value="取消" onclick="cancel()">
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <script src="./js/jquery-3.6.0.min.js"></script>
    <script src="./js/init.js"></script>
    <script>
        let url = location.href
        let id = url.split('?')[1]

        console.log(id);
        $.get(`http://localhost:8000/product`, data => {
            let newId = data.filter(item => {
                return item.id == id
            })

            console.log(newId[0].id);
            $('[name=Id]').val(newId[0].id)
            $('[name=season]').val(newId[0].name)
            $('[name = date]').val(newId[0].date)
        })
    </script>
</body>

</html>